import java.util.Arrays;
import java.util.List;

public class demo6 {
    public static void main(String[] args) {
        List<Integer> originalList = Arrays.asList(1, 2, 2, 3, 4 , 6, 6,  8 );
        System.out.println("原始集合: " + originalList);

        System.out.println("allMatch");
        if(originalList.stream().skip(3).allMatch(x->x%2==0)){
            System.out.println("true");
        }else{
            System.out.println("false");
        }

        if(originalList.stream().skip(4).allMatch(x->x%2==0)){
            System.out.println("true");
        }else{
            System.out.println("false");
        }
        System.out.println();
        System.out.println("anyMatch");
        if(originalList.stream().skip(3).anyMatch(x->x%2!=0)){
            System.out.println("true");
        }else{
            System.out.println("false");
        }

        if(originalList.stream().skip(4).allMatch(x->x%2!=0)){
            System.out.println("true");
        }else{
            System.out.println("false");
        }

        System.out.println();
        System.out.println("findFirst");
        System.out.println(originalList.stream().skip(1).findFirst());
        System.out.println(originalList.stream().skip(2).findFirst());

        System.out.println();
        System.out.println("max min");
        System.out.println(originalList.stream().skip(1).max((a, b) -> a - b));
        System.out.println(originalList.stream().skip(1).max((a, b) -> b - a));
    }

}
